package com.nakamachizu.model.mixi;

import java.io.Serializable;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;

import com.google.appengine.api.datastore.Key;

@Model(schemaVersion = 1)
public class BasePersonFriendModel implements Serializable {

    private static final long serialVersionUID = 1L;

    @Attribute(persistent = false)
    public static final String DISPLAY_NAME = "displayName";

    @Attribute(persistent = false)
    public static final String THUMBNAIL_URL = "thumbnailUrl";
    
    @Attribute(persistent = false)
    public static final String NICK_NAME = "nickname";
    
    @Attribute(persistent = false)
    public static final String ID = "id";
    
    @Attribute(persistent = false)
    public static final String UPDATE = "updated";
    
    @Attribute(persistent = false)
    public static final String HAS_APP = "hasApp";
    
    @Attribute(persistent = false)
    public static final String ADDRESS = "address";
    
    @Attribute(persistent = false)
    public static final String BIRTHDAY = "birthday";
    
    @Attribute(persistent = false)
    public static final String GENDER = "gender";
    
    @Attribute(primaryKey = true)
    private Key key;

    @Attribute(version = true)
    private Long version;

    private int itemsPerPage;
    
    private int startIndex;
    
    private int totalResults;
    
    /**
     * Returns the key.
     *
     * @return the key
     */
    public Key getKey() {
        return key;
    }

    /**
     * Sets the key.
     *
     * @param key
     *            the key
     */
    public void setKey(Key key) {
        this.key = key;
    }

    /**
     * Returns the version.
     *
     * @return the version
     */
    public Long getVersion() {
        return version;
    }

    /**
     * Sets the version.
     *
     * @param version
     *            the version
     */
    public void setVersion(Long version) {
        this.version = version;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((key == null) ? 0 : key.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        BasePersonFriendModel other = (BasePersonFriendModel) obj;
        if (key == null) {
            if (other.key != null) {
                return false;
            }
        } else if (!key.equals(other.key)) {
            return false;
        }
        return true;
    }

    public int getItemsPerPage() {
        return itemsPerPage;
    }

    public void setItemsPerPage(int itemsPerPage) {
        this.itemsPerPage = itemsPerPage;
    }

    public int getStartIndex() {
        return startIndex;
    }

    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public int getTotalResults() {
        return totalResults;
    }

    public void setTotalResults(int totalResults) {
        this.totalResults = totalResults;
    }
}
